package com.fr.lintcode;

import org.junit.Test;

public class Q172 {
	public int removeElement(int[] a, int elem) {
		if (a == null){
			return 0;
		}
		int length = a.length;
		int index = 0;
		for(int i = 0; i <length; i++){
			if (a[i] == elem){
				
			}else{
				a[index] = a[i];
				index ++;
			}
		}
		return index;
    }
	
	@Test
	public void TestA(){
		int[] a = {0,4,4,0,0,2,4,4};
		int elem =4;
		System.out.println(removeElement(a, elem));
	}

}
